<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>

<script>

    alert("测试手机浏览器 alert");
    window.addEventListener('online',function(){
        alert('网络已经连接');
    });

    window.addEventListener("offline",function(){
        alert("网络已经断开");
    })
</script>
</body>
</html>